package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.geom.Vector3D;

	public class SpriteUtil
	{
		public function SpriteUtil()
		{
		}
		
		public static function getRect(width:int, height:int, options:Object=null):Sprite{
			var spr:Sprite = new Sprite();
			spr.graphics.beginFill(0xff0000);
			spr.graphics.drawRect(0,0,width,height);
			spr.graphics.endFill();
			return spr;
		}
		
		public static function getBox(x:Number, y:Number, z:Number):DisplayObject{
			var transformer:ITransformer = Globals.transformer;
			var container:Sprite = new Sprite();
			var spr:Sprite = new Sprite();
			var pos:Vector3D;
			spr.graphics.lineStyle(2);
			spr.graphics.beginFill(0xff0000);
			
			pos = transformer.transform(new Vector3D(0,0,0));
			spr.graphics.moveTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(x,0,0));
			spr.graphics.lineTo(pos.x, pos.y);

			pos = transformer.transform(new Vector3D(x,y,0));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,y,0));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,0,0));	
			spr.graphics.lineTo(pos.x, pos.y);
			//spr.graphics.endFill();
			
			spr.graphics.beginFill(0x00ff00);
			pos = transformer.transform(new Vector3D(0,0,z));
			spr.graphics.moveTo(pos.x, pos.y);			
			
			pos = transformer.transform(new Vector3D(x,0,z));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(x,y,z));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,y,z));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,0,z));				
			spr.graphics.lineTo(pos.x, pos.y);
			//spr.graphics.endFill();
			
			spr.graphics.beginFill(0x0000ff);
			pos = transformer.transform(new Vector3D(0,0,0));
			spr.graphics.moveTo(pos.x, pos.y);			
			
			pos = transformer.transform(new Vector3D(x,0,0));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(x,0,z));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,0,z));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,0,0));				
			spr.graphics.lineTo(pos.x, pos.y);
			//spr.graphics.endFill();			
			
			spr.graphics.beginFill(0x00ffff);
			pos = transformer.transform(new Vector3D(0,0,0));
			spr.graphics.moveTo(pos.x, pos.y);			
			
			pos = transformer.transform(new Vector3D(0,y,0));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,y,z));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,0,z));
			spr.graphics.lineTo(pos.x, pos.y);
			
			pos = transformer.transform(new Vector3D(0,0,0));				
			spr.graphics.lineTo(pos.x, pos.y);
			spr.graphics.endFill();				

			container.addChild(spr);
			spr.x = spr.width/2;
			spr.y = spr.height;
			
			
			return container;
		}
	}
}